﻿@model Smarly.Forum.Bussines.Model.ThreadModel.ThreadNote

@Scripts.Render("~/bundles/js/markitup.forum")

	<script type="text/javascript">
		jQuery(function ($) {
			var $ta = $('#@Html.IdFor(x => x.NoteText)');
			$ta.val('');
			rangyInputs.init();
			rangyInputs.enableTabIndentation($ta[0], "\t");
			$ta.markItUp(mySettings);
		})
	</script>

	<script type="text/javascript">
		$().ready(function () {
			var $form = $('#add-note');
			var url = $form.attr('action');

			var rules = {};
			rules[url] = {
				'@Html.IdFor(x => x.NoteText)': { required: true, },
			};

			var messages = {};
			messages[url] = {
				'@Html.IdFor(x => x.NoteText)': { required: "Поле не заполнено", },
			};

			$form.smarlyValidation({
				ext: {
					rules: rules,
					messages: messages,
				},
				onSuccess: function (data) {
					window.location.reload(true);
				}
			});
		});
	</script>